#include "wagon.h"

// Make a helicopter object
Wagon::Wagon(QWidget * _parent, int coordX, int coordY)
{
    this->setParent(_parent); // set the parent

    // Initialize this label
    this->setGeometry(coordX - 38, coordY - 35, 75, 35);
    this->setObjectName("wagon");

    // Set up movie
    animMovie = new QMovie();
    animMovie->setParent(this);

    // Add the movie
    SetWagonMovie("images/wagonright.mng");

    // Create the timer to make it move
    WagonTimer *timer = new WagonTimer(((HelicopterForm*)(this->parent())));
    timer->object = this;
}

void Wagon::SetWagonMovie(QString link)
{
    // Add the movie
    animMovie->stop();
    animMovie->setFileName(link);
    this->setMovie(animMovie);

    animMovie->setSpeed(100);

    animMovie->start();
    animMovie->setPaused(true);
}
